// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import stores from './store'
import axios from 'axios'
import VueLazyload from 'vue-lazyload'
import Loading from './components/loading/index.js'
//import VueAwesomeSwiper from 'vue-awesome-swiper'
//Vue.use(VueAwesomeSwiper)
Vue.use(Loading);
Vue.use(VueLazyload, {
  loading: require('./assets/default.png')
})
Vue.config.productionTip = false

axios.interceptors.request.use(function (config) {  //配置发送请求的信息
  stores.dispatch('showLoading')  
  return config;
}, function (error) {
  return Promise.reject(error);
});

axios.interceptors.response.use(function (response) { //配置请求回来的信息
  stores.dispatch('hideLoading')
  return response;
}, function (error) {

  return Promise.reject(error);
});

Vue.prototype.$http = axios // 类似于vue-resource的调用方法

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
    store:stores,
  template: '<App/>',
  components: { App }
})
